﻿@model Webdiyer.WebControls.Mvc.IPagedList<HouseAgencySite.Models.HouseInfos>
@using HouseAgencySite.Utils;

@{
    Layout = "~/Areas/Admin/Views/Shared/_ListLayout.cshtml";
    ViewBag.Title = "房源信息列表";
}
@{
    List<SelectListItem> list = HouseAgencySite.Utils.ParamHelper.GetHouseArea(Request["AreaID"], true);
    List<SelectListItem> listHuXing = HouseAgencySite.Utils.ParamHelper.HuXing(true,Request["AreaID"]);
    List<SelectListItem> listHouseType = HouseAgencySite.Utils.ParamHelper.HouseType(true, Request["AreaID"]);
}
@section query{
    <table class="table table-bordered">
        <tr>
            <td>标题</td>
            <td>
                <input type="text" name="Title" id="Title"  value="@Request["Title"]"/>
            </td>
            <td>价格</td>
            <td>
                <input type="text" name="PriceLeft" id="PriceLeft"  value="@Request["PriceLeft"]" class="rangeclass"/>-
                <input type="text" name="PriceRight" id="PriceRight"  value="@Request["PriceRight"]"  class="rangeclass"/>
            </td>
            <td>面积</td>
            <td  >
                <input type="text" name="MianJiLeft" id="MianJiLeft"  value="@Request["MianJiLeft"]"  class="rangeclass"/>-
                <input type="text" name="MianJiRight" id="MianJiRight"  value="@Request["MianJiRight"]" class="rangeclass"/>
            </td>
             <td rowspan="2"  style="vertical-align:middle;">
                <input type="submit" value="查询" id="btnSearch" class="btn btn-primary" />&nbsp;&nbsp;<input type="reset" value="重置" id="btnReset" class="btn btn-primary" /></td>
        </tr>
        <tr>
             <td>类型</td>
            <td>
                @Html.DropDownList("HouseType", listHouseType, new { @class = "form-control", style = "width:150px" })
            </td>
            <td>地区</td>
            <td>
                @Html.DropDownList("AreaID", list, new { @class = "form-control", style = "width:150px" })
            </td>
             <td>户型</td>
            <td>
                @Html.DropDownList("HuXing", listHuXing, new { @class = "form-control", style = "width:150px" })
            </td>
           
        </tr>

    </table>
}
@section toolbar{
    <a href="javascript:void(0);" onclick="Edit('@Url.Action("Create", "HouseInfo", null)',900,800,null)" class="btn btn-primary">新增</a>
}
@section list{
    <table class="table table-bordered" style="width: 100%;">

        <tr class="btn-success">
            <th>序号
            </th>
            <th>标题
            </th>
            <th>价格
            </th>
            <th>面积
            </th>
          @*  <th>楼层
            </th>*@
            <th>户型
            </th>
            <th style="display:none;">地址</th>
            <th>类型</th>
            <th>创建时间
            </th>
            <th>创建人
            </th>
            <th>操作</th>
        </tr>
        @{
            int i = 0;
        }
        @foreach (var item in Model)
        {
        
            <tr class="@(i % 2 == 0 ? "success" : "warning")">
                <td>
                    @((i + 1) + (Model.CurrentPageIndex - 1) * 10)
                </td>
                <td>
                   <span title="@item.Title"> @(item.Title.Length>13?item.Title.Substring(0,10)+"...":item.Title)</span> 
                </td>

                <td>
                    @Html.DisplayFor(modelItem => item.Price)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.MianJi)
                </td>
               @* <td>
                    @Html.DisplayFor(modelItem => item.LouCeng)
                </td>*@
                <td>
                  @listHuXing.FirstOrDefault(o=>o.Value==item.HuXing.ToString()).Text
                </td>
                <td style="display:none;">
                    @Html.DisplayFor(modelItem => item.AddressDetail)
                </td>

                <td>
                     @listHouseType.FirstOrDefault(o=>o.Value==item.HouseType.ToString()).Text
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreateTime)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreateUserName)
                </td>

                <td>
                    <a href="javascript:void(0);" onclick="Edit('@Url.Action("Edit", "HouseInfo", new { id = item.Guid })',1000,1000,null)" class="btn btn-primary btn-xs">编辑</a> |
                    <a  href="/Home/Detail/@(item.Guid)" target="_blank" class="btn btn-primary btn-xs">查看</a>|
                    <a href="javascript:void(0);" onclick="Delete('@Url.Action("Delete", "HouseInfo", new { id = item.Guid })')" class="btn btn-primary btn-xs">删除</a>
                </td>
            </tr>
            i++;
        }

    </table>
}
<div class="text-center">@Html.HtmlPager(Model)</div>

